﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DatabaseAccess;

namespace Liguo.Administration
{
    public partial class GoodsType : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
               
                DataSet a = new DataSet();
                DBAccess b = new DBAccess();
                a = b.ExecuteDataSet("select * from GoodsType");
                GridView1.DataSource = a;
                GridView1.DataBind();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text.Length > 20)
            {
                Response.Write("<script type='text/javascript'>alert('输入出错');</script>");
                return;
            }
            if (TextBox1.Text.Length==0)
            {
                Response.Write("<script type='text/javascript'>alert('输入不能为空');</script>");
                return;
            }
            String a = TextBox1.Text;
            SqlIt b = new SqlIt();
            b.SpecialAdd("GoodsType", "TypeName", a);
           
            Response.Write("<script type='text/javascript'>alert('添加成功！');</script>");
            Response.Redirect("AddGoods.aspx");


        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("AddGoods.aspx");
        }
    }
}